package cz.mendelu.swi2.documents.model;

import java.sql.Date;
import java.util.ArrayList;


import cz.mendelu.swi2.documents.model.enums.DocumentType;
import cz.mendelu.swi2.documents.model.states.NonPublishedState;
import cz.mendelu.swi2.documents.model.versionImplementations.GoogleDocsImplementation;
import cz.mendelu.swi2.documents.model.versionImplementations.HTMLImplementation;
import cz.mendelu.swi2.documents.model.versionImplementations.XMLImplementation;



/**
 * Document manager for all document operations.
 * 
 * @author Jakub Skrha, xskrha
 */
public class DocumentManager {

	/**
	 * Fetch document by id.
	 * 
	 * @param id
	 */
	public Document fetchById(int id) {
		// Document doc = new Document();
		Document doc = new Document(1, new Date(2012, 04, 01), "Document for Google Docs", DocumentType.GoogleDocsDocument);
		return doc;
	}
	
	/**
	 * Load version list of document.
	 * 
	 * @param doc
	 */
	public Document loadVersionListForDocument(Document doc) {
		ArrayList<Version> versions = new ArrayList<Version>();
		// versions.add(new Version());
		
		versions.add(new Version(1, new XMLImplementation(), new Date(2012, 04, 01), new Date(2012, 04, 01), "Docoment version 1", new NonPublishedState()));
		versions.add(new Version(2, new HTMLImplementation(), new Date(2012, 04, 01), new Date(2012, 04, 01), "Docoment version 2", new NonPublishedState()));
		versions.add(new Version(3, new GoogleDocsImplementation(), new Date(2012, 04, 01), new Date(2012, 04, 01), "Docoment version 3", new NonPublishedState()));
		versions.add(new Version(4, new GoogleDocsImplementation(), new Date(2012, 04, 01), new Date(2012, 04, 01), "Docoment version 4", new NonPublishedState()));
		versions.add(new Version(5, new GoogleDocsImplementation(), new Date(2012, 04, 01), new Date(2012, 04, 01), "Docoment version 5", new NonPublishedState()));
		
		doc.setVersionsList(versions);
		
		return doc;
	}
	
	
}
